<include file="mobile/Public/header" />
<link rel="stylesheet" href="__CSS__/index.css">
<link rel="stylesheet" href="__CSS__/fonts.css">
<link rel="stylesheet" href="__CSS__/swiper/swiper.min.css">
<link rel="stylesheet" href="__CSS__/swiper.css">
<header class="color-main vertical-box">
    <span class="header-title"><php> echo (!empty($shop['title']))? $shop['title']:'请在管理后台设置标题' </php></span>
    <!--<div class="header-left vertical-box">
        <img class="img-btn" src="__IMG__/search.png">
    </div>-->
</header>
<php>
if(!empty($shop['notice'])){
    </php>
    <aside class="horn-aside linear-section">
        <span class="horn-icon linear-title vertical-box">
            <img src="__IMG__/horn.png">
        </span>
        <span class="horn-brief linear-title vertical-box" style="">
            <span class="horn-auto-scroll">{$shop['notice']}</span>
        </span>
    </aside>
<php>
}
</php>
<nav>
    <div class="nav-swiper-container">
        <div class="swiper-wrapper">
            <php>
            if(!empty($slides)){
                foreach($slides as $s){
                    </php>
                    <div class="swiper-slide">
                        <a href="<php> echo $s['link'] </php>">
                            <img class="slide-img index-nav-scale" src="<php> echo $s['image'] </php>">
                        </a>
                    </div>
            <php>
                }
            }
            </php>
        </div>
        <div class="swiper-count-box">
            <span class="active-index-num">1</span> / <span class="all-index-num">1</span>
        </div>
    </div>
</nav>
<article class="nav-footer-margin">
    <php>
    if(!empty($products['list'])){
        foreach($products['list'] as $p){
            </php>
            <section class="index-section" onclick="window.location.href='{:U('shop/index/product')}<php> echo "&id=".$p['id'] </php>'">
                <p class="index-section-title big-text"><php> echo $p['title'] </php></p><!--todo:字数限制-->
                <div class="index-section-pic-box">
                    <img class="index-section-pic echo-img" data-echo="<php> echo pic($p['main_img']) </php>" src="">
                    <div class="section-pic-tips-group">
                        <php>
                        $count = 0;
                        $status = explode(',',$p['info']);
						array_walk($status,
	                        function ($a)
	                        {
		                        switch($a){
		                        case 6:
		                        echo '<p class="section-pic-tips" style="background: #fc7539;">热销</p>';
		                        break;
		                        case 7:
		                        echo '<p class="section-pic-tips" style="background: #7fbf23;">推荐</p>';
		                        break;
	                        }
	                        });
                        </php>
                    </div>
                </div>
                <div class="index-section-footer">
                    <span class="secondary-font">￥<php> echo sprintf("%.2f", $p['price']/100) </php></span>
                    <php>
                    if(!empty($p['ori_price']) && ($p['ori_price']>$p['price'])){
                        </php>
                        <span class="white-tips-font small-text" style="text-decoration: line-through">
                            ￥<php> echo sprintf("%.2f", $p['ori_price']/100) </php>
                        </span>
                        <php>
                    }
                    </php>
                    <article class="section-btn-group clearfix">
                        <!--<section class="add-cart-btn vertical-box"><img src="__IMG__/cart.png"></section>
                        <section class="vertical-box"><img src="/app/shop/view/wap/static/images/collect.png"></section>
                        <section class="vertical-box"><img src="/app/shop/view/wap/static/images/share.png"></section>-->
                    </article>
                </div>
            </section>
    <php>
        }
    }
    else{
        </php>
        <p class="list-bottom-tips">缺少商品，请在管理后台添加商品</p>
    <php>
    }
    </php>
</article>

<include file="mobile/Public/nav-footer" />
<include file="mobile/Public/footer" />

<script>
    //'jquery' or 'zepto' 脚本入口,按情况选择加载
    seajs.use(['jquery','echo'], function () {
        $(document).ready(function () {
            seajs.use('seajs/swiper');
            $('.add-cart-btn').click(function(e){
                e.stopPropagation();
            });
            seajs.use('transit',function () {
                /*公告滚动效果*/
                var scroll_speed = 75;//平均速度，px/秒
                var delay_time = 1000;//延迟时间
                $('.horn-auto-scroll').each(function () {
                    var parent_length = $(this).closest('.horn-aside').width()-40;
                    var length = $(this).width();
                    if(length>parent_length){
                        var scroll_time = length/scroll_speed*1000;
                        var $this = $(this);
                        function scroll() {
                            $this.transition({
                                'left':'-100%',
                                'duration':scroll_time,
                                'delay':delay_time,
                                'complete': function (ret) {
                                    $this.css('left',0)
                                }
                            })
                        }
                        setInterval(function () {
                            scroll();
                        },500);
                    }
                })
            });
        })
    });
</script>
</body>
</html>